﻿Public Class clcasillaAgua : Inherits clCasilla : Implements IEquatable(Of clcasillaAgua)

    ''' <summary>
    ''' Fer Zacrón arreglará esto `,..,´ ¡EN SU CASA!
    ''' </summary>
    ''' <param name="Objeto"></param>
    ''' <remarks></remarks>
    Public Sub New(ByVal Objeto As Control)
        MyBase.New(ElSuelo.Inaccesible, Objeto)
        ImagenPredeterminada = My.Resources.agua
        If Objeto.GetType = GetType(PictureBox) Then
            TryCast(Objeto, PictureBox).BackgroundImage = ImagenPredeterminada
        End If
    End Sub
    Public Function ValidarAccesoA(ByVal Inventario As clInventario) As Boolean
        'Dim objetoAgua As clObjetoAgua
        'If Inventario.contains(objetoAgua) Then
        _Suelo = ElSuelo.Accesible
        Return True
        'Else
        _Suelo = ElSuelo.Inaccesible
        Return False
        'End If
    End Function
    Public Shared Function ValidarAccesoA(ByVal inventario As clInventario, ByRef Agua As List(Of clcasillaAgua)) As Boolean
        'Dim objetoAgua As clObjetoAgua
        'If inventario.contains(objetoAgua) Then
        If Agua.Count = 0 Then Throw New Exception("Si preguntas si es accesible al agua y NO me traes agua a la que acceder, bien vamos...")
        For Each X As clcasillaAgua In Agua
            X._Suelo = ElSuelo.Accesible
        Next
        Return True
        'Else
        For Each X As clcasillaAgua In Agua
            X._Suelo = ElSuelo.Inaccesible
        Next
        Return False
        'End If
    End Function



    Public Overloads Function Equals(ByVal AguaB As clcasillaAgua) As Boolean Implements System.IEquatable(Of clcasillaAgua).Equals
        Return clCasilla.Equals(Me, AguaB)
    End Function
    Public Overloads Shared Function Equals(ByVal A As clcasillaAgua, ByVal B As clcasillaAgua) As Boolean
        Return A.GetType = B.GetType.GetType And A.Control.Name = B.Control.Name
    End Function
End Class
